.class public Lrexsee/keyboard/TouchBallDialog;
.super Lrexsee/core/widget/DivDialog;
.source "TouchBallDialog.java"


# direct methods
.method public constructor <init>(Lrexsee/core/browser/Browser;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lrexsee/keyboard/TouchBallWidget$OnTouchBallMoveListener;)V
    .locals 7
    .param p1, "browser"    # Lrexsee/core/browser/Browser;
    .param p2, "dialogId"    # Ljava/lang/String;
    .param p3, "style"    # Ljava/lang/String;
    .param p4, "ball"    # Ljava/lang/String;
    .param p5, "background"    # Ljava/lang/String;
    .param p6, "onTouchBallMoveListener"    # Lrexsee/keyboard/TouchBallWidget$OnTouchBallMoveListener;

    .prologue
    .line 18
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v4, "width:180;height:180;window-cancelable:false;window-moveable:true;window-outside-cancelable:false;window-modeless:true;window-dim-amount:0;background-color:transparent;border-width:0;alpha:0.2;icon-alpha:0.5;"

    invoke-direct {v1, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {p0, p1, p2, v1}, Lrexsee/core/widget/DivDialog;-><init>(Lrexsee/core/browser/Browser;Ljava/lang/String;Ljava/lang/String;)V

    .line 19
    iget-object v1, p0, Lrexsee/keyboard/TouchBallDialog;->div:Lrexsee/core/widget/Div;

    const/4 v4, 0x0

    invoke-virtual {v1, v4}, Lrexsee/core/widget/Div;->setOnTouchListener(Landroid/view/View$OnTouchListener;)V

    .line 20
    invoke-static {p1, p4}, Lrexsee/core/style/RexseeDrawable;->getDrawable(Lrexsee/core/browser/Browser;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;

    move-result-object v2

    .line 21
    .local v2, "ballDrawable":Landroid/graphics/drawable/Drawable;
    new-instance v1, Landroid/graphics/drawable/ColorDrawable;

    const/4 v4, 0x0

    invoke-direct {v1, v4}, Landroid/graphics/drawable/ColorDrawable;-><init>(I)V

    invoke-static {p1, p5, v1}, Lrexsee/core/style/RexseeDrawable;->getDrawable(Lrexsee/core/browser/Browser;Ljava/lang/String;Landroid/graphics/drawable/Drawable;)Landroid/graphics/drawable/Drawable;

    move-result-object v3

    .line 22
    .local v3, "backgroundDrawable":Landroid/graphics/drawable/Drawable;
    new-instance v0, Lrexsee/keyboard/TouchBallWidget;

    iget-object v1, p0, Lrexsee/keyboard/TouchBallDialog;->mContext:Landroid/content/Context;

    move-object v4, p0

    move-object v5, p6

    invoke-direct/range {v0 .. v5}, Lrexsee/keyboard/TouchBallWidget;-><init>(Landroid/content/Context;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Lrexsee/keyboard/TouchBallDialog;Lrexsee/keyboard/TouchBallWidget$OnTouchBallMoveListener;)V

    .line 23
    .local v0, "ballWidget":Lrexsee/keyboard/TouchBallWidget;
    invoke-virtual {p0, v0}, Lrexsee/keyboard/TouchBallDialog;->addChild(Landroid/view/View;)V

    .line 24
    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Lrexsee/keyboard/TouchBallWidget;->setClickable(Z)V

    .line 25
    iget-object v1, p0, Lrexsee/keyboard/TouchBallDialog;->div:Lrexsee/core/widget/Div;

    iget-object v1, v1, Lrexsee/core/widget/Div;->styleSheet:Lrexsee/core/style/StyleSheet;

    iget-object v1, v1, Lrexsee/core/style/StyleSheet;->background_color:Ljava/lang/String;

    invoke-static {p1, v1}, Lrexsee/core/style/RexseeDrawable;->getDrawable(Lrexsee/core/browser/Browser;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;

    move-result-object v6

    .line 26
    .local v6, "backDrawable":Landroid/graphics/drawable/Drawable;
    iget-object v1, p0, Lrexsee/keyboard/TouchBallDialog;->div:Lrexsee/core/widget/Div;

    iget-object v1, v1, Lrexsee/core/widget/Div;->styleSheet:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v1}, Lrexsee/core/style/StyleSheet;->getAlpha()F

    move-result v1

    const/high16 v4, 0x437f0000    # 255.0f

    mul-float/2addr v1, v4

    invoke-static {v1}, Ljava/lang/Math;->round(F)I

    move-result v1

    invoke-virtual {v6, v1}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V

    .line 27
    invoke-virtual {p1}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v1

    check-cast v1, Landroid/app/Activity;

    new-instance v4, Lrexsee/keyboard/TouchBallDialog$1;

    invoke-direct {v4, p0, v6}, Lrexsee/keyboard/TouchBallDialog$1;-><init>(Lrexsee/keyboard/TouchBallDialog;Landroid/graphics/drawable/Drawable;)V

    invoke-virtual {v1, v4}, Landroid/app/Activity;->runOnUiThread(Ljava/lang/Runnable;)V

    .line 33
    return-void
.end method


# virtual methods
.method public onKeyDown(ILandroid/view/KeyEvent;)Z
    .locals 2
    .param p1, "keyCode"    # I
    .param p2, "event"    # Landroid/view/KeyEvent;

    .prologue
    const/4 v1, 0x1

    .line 67
    const/4 v0, 0x4

    if-ne p1, v0, :cond_2

    .line 68
    iget-object v0, p0, Lrexsee/keyboard/TouchBallDialog;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->menu:Lrexsee/core/menu/RexseeMenu;

    iget-boolean v0, v0, Lrexsee/core/menu/RexseeMenu;->isOptionsMenuOpen:Z

    if-eqz v0, :cond_0

    .line 69
    iget-object p0, p0, Lrexsee/keyboard/TouchBallDialog;->mContext:Landroid/content/Context;

    .end local p0    # "this":Lrexsee/keyboard/TouchBallDialog;
    check-cast p0, Landroid/app/Activity;

    invoke-virtual {p0}, Landroid/app/Activity;->closeOptionsMenu()V

    move v0, v1

    .line 83
    :goto_0
    return v0

    .line 72
    .restart local p0    # "this":Lrexsee/keyboard/TouchBallDialog;
    :cond_0
    iget-object v0, p0, Lrexsee/keyboard/TouchBallDialog;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v0, v0, Lrexsee/core/browser/Browser;->function:Lrexsee/core/browser/RexseeBrowser;

    invoke-virtual {v0}, Lrexsee/core/browser/RexseeBrowser;->goBack()V

    .line 83
    .end local p0    # "this":Lrexsee/keyboard/TouchBallDialog;
    :cond_1
    :goto_1
    const/4 v0, 0x0

    goto :goto_0

    .line 74
    .restart local p0    # "this":Lrexsee/keyboard/TouchBallDialog;
    :cond_2
    const/16 v0, 0x52

    if-ne p1, v0, :cond_3

    .line 75
    iget-object p0, p0, Lrexsee/keyboard/TouchBallDialog;->mContext:Landroid/content/Context;

    .end local p0    # "this":Lrexsee/keyboard/TouchBallDialog;
    check-cast p0, Landroid/app/Activity;

    invoke-virtual {p0}, Landroid/app/Activity;->openOptionsMenu()V

    goto :goto_1

    .line 76
    .restart local p0    # "this":Lrexsee/keyboard/TouchBallDialog;
    :cond_3
    const/16 v0, 0x54

    if-ne p1, v0, :cond_4

    move v0, v1

    .line 77
    goto :goto_0

    .line 78
    :cond_4
    const/16 v0, 0x50

    if-eq p1, v0, :cond_1

    .line 79
    const/16 v0, 0x18

    if-eq p1, v0, :cond_1

    goto :goto_1
.end method

.method public start()V
    .locals 6

    .prologue
    .line 36
    invoke-virtual {p0}, Lrexsee/keyboard/TouchBallDialog;->show()V

    .line 38
    invoke-virtual {p0}, Lrexsee/keyboard/TouchBallDialog;->getWindow()Landroid/view/Window;

    move-result-object v3

    .line 39
    .local v3, "window":Landroid/view/Window;
    invoke-virtual {v3}, Landroid/view/Window;->getAttributes()Landroid/view/WindowManager$LayoutParams;

    move-result-object v0

    .line 41
    .local v0, "attr":Landroid/view/WindowManager$LayoutParams;
    iget-object v4, p0, Lrexsee/keyboard/TouchBallDialog;->styleSheet:Lrexsee/core/style/StyleSheet;

    iget-object v4, v4, Lrexsee/core/style/StyleSheet;->window_split_screen:Ljava/lang/String;

    const-string v5, "true"

    invoke-virtual {v4, v5}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v4

    if-eqz v4, :cond_4

    const/16 v4, 0x7db

    :goto_0
    iput v4, v0, Landroid/view/WindowManager$LayoutParams;->type:I

    .line 42
    iget-object v4, p0, Lrexsee/keyboard/TouchBallDialog;->styleSheet:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v4}, Lrexsee/core/style/StyleSheet;->getWindowAnimation()I

    move-result v4

    iput v4, v0, Landroid/view/WindowManager$LayoutParams;->windowAnimations:I

    .line 44
    iget-object v4, p0, Lrexsee/keyboard/TouchBallDialog;->styleSheet:Lrexsee/core/style/StyleSheet;

    iget-object v4, v4, Lrexsee/core/style/StyleSheet;->window_dim_amount:Ljava/lang/String;

    invoke-static {v4}, Ljava/lang/Float;->parseFloat(Ljava/lang/String;)F

    move-result v4

    iput v4, v0, Landroid/view/WindowManager$LayoutParams;->dimAmount:F

    .line 46
    iget-object v4, p0, Lrexsee/keyboard/TouchBallDialog;->styleSheet:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v4}, Lrexsee/core/style/StyleSheet;->getWindowGravity()I

    move-result v4

    iput v4, v0, Landroid/view/WindowManager$LayoutParams;->gravity:I

    .line 47
    iget-object v4, p0, Lrexsee/keyboard/TouchBallDialog;->styleSheet:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v4}, Lrexsee/core/style/StyleSheet;->getTop()I

    move-result v2

    .line 48
    .local v2, "top":I
    if-gez v2, :cond_0

    .line 49
    iget-object v4, p0, Lrexsee/keyboard/TouchBallDialog;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v4, v4, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget v4, v4, Lrexsee/core/application/RexseeApplication;->screenHeight:I

    add-int/2addr v2, v4

    .line 51
    :cond_0
    iget-object v4, p0, Lrexsee/keyboard/TouchBallDialog;->styleSheet:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v4}, Lrexsee/core/style/StyleSheet;->getLeft()I

    move-result v1

    .line 52
    .local v1, "left":I
    if-gez v1, :cond_1

    .line 53
    iget-object v4, p0, Lrexsee/keyboard/TouchBallDialog;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v4, v4, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget v4, v4, Lrexsee/core/application/RexseeApplication;->screenWidth:I

    add-int/2addr v1, v4

    .line 55
    :cond_1
    if-eqz v1, :cond_2

    iput v1, v0, Landroid/view/WindowManager$LayoutParams;->x:I

    .line 56
    :cond_2
    if-eqz v2, :cond_3

    iput v2, v0, Landroid/view/WindowManager$LayoutParams;->y:I

    .line 58
    :cond_3
    iget-object v4, p0, Lrexsee/keyboard/TouchBallDialog;->styleSheet:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v4}, Lrexsee/core/style/StyleSheet;->getWidth()I

    move-result v4

    iput v4, v0, Landroid/view/WindowManager$LayoutParams;->width:I

    .line 59
    iget-object v4, p0, Lrexsee/keyboard/TouchBallDialog;->styleSheet:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v4}, Lrexsee/core/style/StyleSheet;->getHeight()I

    move-result v4

    iput v4, v0, Landroid/view/WindowManager$LayoutParams;->height:I

    .line 61
    invoke-virtual {v3, v0}, Landroid/view/Window;->setAttributes(Landroid/view/WindowManager$LayoutParams;)V

    .line 63
    return-void

    .line 41
    .end local v1    # "left":I
    .end local v2    # "top":I
    :cond_4
    const/4 v4, 0x2

    goto :goto_0
.end method
